<!DOCTYPE html>
<html>
	<head>
		<meta charset="utf-8">
		<title>我的购物车</title>
		<link rel="stylesheet" type="text/css" href="../static/css/public.css" />
		<link rel="stylesheet" type="text/css" href="../static/lib/layui/css/layui.css" />
		<script src="../static/lib/layui/layui.js" type="text/javascript" charset="utf-8"></script>
		<script src="../static/js/public.js" type="text/javascript" charset="utf-8"></script>
	</head>
	<body>
		<div class="cart-container">
			<div class="layui-form" id="shopping-carts">
				<div class="cart">
					<input type="checkbox" name="selectAll" title="全选" lay-skin="primary"  lay-filter="selectAll" >
					<hr />
				</div>
			</div>
			<div class="layui-form">
				<button type="button" class="layui-btn layui-btn-normal" id="buyBtn">立即购买</button>
				<button type="button" class="layui-btn layui-btn-danger" id="deleteSelectedBtn">删除选中</button>
			</div>
		</div>
	</body>
	<link rel="stylesheet" type="text/css" href="../static/css/cart.css"/>
	<script src="../static/js/cart.js" type="text/javascript" charset="utf-8"></script>
	<script type="text/html" id="shopping-carts-tpl">
		{{# layui.each(d,function(index,item){    }}
			<div class="cart">
				<input type="checkbox" name="cartId" value="{{item.cartId}}" c-bookId="{{item.bookId}}" c-price="{{item.book_info.price}}" lay-skin="primary" lay-filter="selectOne">
				<a href="/xxx/{{item.bookId}}"><img src="../static/images/book_images/{{item.book_info.image}}" alt="{{item.book_info.bookName}}"/></a>
				<div class="cart-info">
					<p><a href="/xxx/{{item.bookId}}">{{item.book_info.bookName}}</a></p>
					<p>{{item.book_info.author}}&nbsp;/&nbsp;{{item.book_info.pubDate}}&nbsp;/&nbsp;{{item.book_info.press}}</p>
					<p>¥&nbsp;{{item.book_info.price}}</p>
					<p>购买数量：<input type="number" min="0" max="10" value="{{item.quantity}}" id="quantity-{{item.cartId}}" onchange="checkAndCalculate(this,{{item.cartId}},{{item.book_info.price}})"/></p>
				</div>
				<div class="cart-delete">
					<p>¥<span id="total-{{item.cartId}}">{{ calculate(item.book_info.price,item.quantity) }}</span></p>
					<button type="button" class="layui-btn layui-btn-xs" onclick="deleteByCartId({{item.cartId}})">删除</button>
				</div>
			</div>
		{{#     });       }}
	</script>
</html>
